import numpy as np
import matplotlib.pyplot as plt


def f2():
    # 绘制函数图形
    x = np.linspace(0, 20, 1000)
    y = np.sin(x) + 1
    z = np.cos(x ** 3) + 1
    # 设置图像大小
    plt.figure(figsize=(8, 4))
    # 作图设置标签，线条颜色，线条大小
    plt.plot(x, y, label='$\sinx+1$', color='red', linewidth=2)
    plt.plot(x, y, 'b--', label='$\cosx^3+1$', linewidth=1)
    plt.title('函数图像')
    plt.ylim(0, 2.2)
    plt.legend()
    plt.show()


if __name__ == '__main__':
    f2()
